from django.conf.urls import url
from rest_framework.routers import DefaultRouter

from apps.areas import views

urlpatterns = [
    # url(r'^infos/$',views.AreaInfoView.as_view({"get":"list"}) ), #获取所有地区
    # url(r'^infos/(?P<pk>\d+)/$',views.AreaInfoView.as_view({"get":"retrieve"}) ),  #根据id获取地区

]

#1,创建DefaultRouter对象
route=DefaultRouter()
#2,注册视图集
route.register(r"infos",views.AreaInfoView,"areas")
#3,添加到urlpatterns
urlpatterns+=route.urls